package terra.network.packet.client;

import org.jboss.netty.buffer.ChannelBuffer;

import terra.network.packet.Packet;


public class RequestUseItem extends Packet {

	public int playerId;
	public int oId;
	public int id;
	
	public RequestUseItem(int playerId, int oId,int id) {
		this.playerId = playerId;
		this.oId = oId;
		this.id = id;
	}

	public RequestUseItem() {
	}

	@Override
	public ChannelBuffer toBuffer() {
		ChannelBuffer buf = getNewBuffer();
		buf.writeByte(getId());
		buf.writeInt(playerId);
		buf.writeInt(oId);
		buf.writeInt(id);
		return buf;
	}

	@Override
	public Packet fromBuffer(ChannelBuffer buf) {
		playerId = buf.readInt();
		oId = buf.readInt();
		id = buf.readInt();
		return this;
	}

	@Override
	public int getLength() {
		return 13;
	}

	@Override
	public boolean isDynamicLength() {
		return false;
	}

	@Override
	public byte getId() {
		return 18;
	}

	@Override
	public byte getPriority() {
		return PRIOR_NORMAL;
	}

}
